package cn.tedu.store.controller;

import cn.tedu.store.common.ApiResult;
import cn.tedu.store.entity.HistClientList;
import cn.tedu.store.entity.PbkoXxk;
import cn.tedu.store.mapper.EmployeeMapper;
import cn.tedu.store.service.IRepairService;
import cn.tedu.store.service.PbkoXxkService;
import cn.tedu.store.temperatureDetection.entity.dto.EmployeeDto;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("duty")
public class DutyController {

    @Resource
    PbkoXxkService pbkoXxkService;
    @Resource
    IRepairService repairService;


    @RequestMapping("selcetDuty")
    public Map<String,List<PbkoXxk>> selcetDuty(int page, int pageSize){

        List<PbkoXxk> pbkoXxks =  pbkoXxkService.selcet( page,pageSize);
        HashMap<String, List<PbkoXxk>> stringListHashMap = new HashMap<>();
        return stringListHashMap;
    }

    @Resource
    IRepairService iRepairService;
    @Resource
    EmployeeMapper employeeMapper;
    //测试
    @GetMapping("test")
    public void test() throws ParseException {

        List<EmployeeDto> dept  = employeeMapper.getDeptName();
        ArrayList<String> list = new ArrayList<>();
        String name = "";
        for (EmployeeDto employeeDto : dept) {
            name+=employeeDto.getDeptName()+"、";
        }

        System.out.println(name);
    }

    @GetMapping("t1")
    public void test1(){
        iRepairService.morningClock();
    }

    public static void main(String[] args) {
        String s = "<div id=\"wea_rich_text_default_font\" style=\"font-family:微软雅黑;font-size:12;\"><p>消化内科护士王苏玲工号001335，已通过独立上岗能力评估，现申请开通工号权限，开展临床护理各项工作。</p>\n" +
                "</div>";

    }

    @GetMapping("macList")
    public ApiResult macList(){
        List<HistClientList> histClientList =pbkoXxkService.getMACList();
        return ApiResult.ok(histClientList);
    }

    //预服务    添加
    @GetMapping("preService")
    public ApiResult preService(String phone,String mac){

    pbkoXxkService.preService(phone,mac);

        return ApiResult.ok("添加成功");
    }



    }
